package nl.infodation.emr.pricingservice.business;

import java.util.List;

import nl.infodation.emr.pricingservice.data.DomainRuleSearchItem;
import nl.infodation.emr.pricingservice.entity.DomainRule;

import com.googlecode.genericdao.search.SearchResult;
import com.vaadin.data.util.BeanItem;

/**
 * @author SUCCESS\tungo
 *
 */
public interface RuleBusiness {
	
	/**
	 * Save list of DomainRule
	 * @param rules
	 * @return
	 */
	Boolean saveRules(List<DomainRule> rules);
	
	/**
	 * Save DomainRule
	 * @param rule
	 * @param roleName
	 * @return
	 */
	Boolean saveRule(DomainRule rule, String roleName);
	
	/**
	 * Search & paging DomailRule
	 * @param roleName
	 * @param environmentId
	 * @param searchData
	 * @param startPage
	 * @param pageSize
	 * @return
	 */
	@SuppressWarnings("rawtypes")
	SearchResult<BeanItem> searchRules(String roleName, Integer environmentId, DomainRuleSearchItem searchData, int startPage,
			int pageSize);
	
	/**
	 * Search list of DomainRule
	 * @param searchData
	 * @return
	 */
	List<Long> searchRulesIDs(DomainRuleSearchItem searchData);

	/**
	 * Find all DomainRule by Bussiness Line 
	 * @return
	 */
	List<DomainRule> findRulesByBusLine(String busLine);
	
	/**
	 * Find all DomainRule by ID list
	 * @param IDs
	 * @return
	 */
	List<DomainRule> findRulesByIDs(List<Long> IDs);
	
	/** Find DomainRule by name and check the name
	 * @param name
	 * @param environmentId
	 * @param checkName
	 * @return
	 */
	DomainRule findRuleByNameAndCheck(String name, Integer environmentId, String checkName);
		
	/**
	 * Count DomainRule with the name
	 * @param name
	 * @return
	 */
	Integer existRuleName(String name);
	
	/**
	 * Copy checked DomainRule to another environment
	 * @param superBusLine
	 * @param busLine
	 * @param environmentId
	 * @param clean
	 * @param IDs
	 * @return
	 */
	Boolean copyToEnvironment(String superBusLine, String busLine, int environmentId, Boolean clean, List<Long> IDs);
	
}
